UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VzOSn2kvW+6igU7+wzfmAOFalsrHVhh63oWaKbDOHAE=' 
WHERE 
  key_id = '0f39835e3da0fd2950ab1e0ba8abfd602e68c1035ef9e1d579a94da249d5fa70' 
  AND (
    token = 'VzOSn2kvW+6igU7+wzfmAOFalsrHVhh63oWaKbDOHAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033