UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1DW7Mb7hCh+yYhENftmHwmn6mTtFZNRQCv2FyB+WY5M=' 
WHERE 
  key_id = 'ae86e7a3d6d3a0650f2ada21afce254da54eb487e6cbc2daf9977a17d1404087' 
  AND (
    token = '1DW7Mb7hCh+yYhENftmHwmn6mTtFZNRQCv2FyB+WY5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045