UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ESBKn7f15zUIdswfu1rLXdzKjLDciuEaUON4PrnOGY=' 
WHERE 
  key_id = '83c21acb86c117651b6609bdd5bf1c83fd869f0e0901c6733e2c7931376838b2' 
  AND (
    token = '1ESBKn7f15zUIdswfu1rLXdzKjLDciuEaUON4PrnOGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034