UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xX8BviQX0c4naq6RFTNJ0GexdZBNzwidzI3mxLtRnpg=' 
WHERE 
  key_id = '50e63613b30342db17bee743a51e988c618ee12627d9041d4c935e1730af09b6' 
  AND (
    token = 'xX8BviQX0c4naq6RFTNJ0GexdZBNzwidzI3mxLtRnpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047