UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9QnwMl56iEDkQunKEGQg27wZ5iP06zHbOWhwaNf66MY=' 
WHERE 
  key_id = 'fab1abc2741ecb0441137023818c8789855686295ee15792ac2963f250d38df6' 
  AND (
    token = '9QnwMl56iEDkQunKEGQg27wZ5iP06zHbOWhwaNf66MY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027