UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pNW/PZbTgToBoULWv/r9CsK1eLQ2bkrVoL+JIXXr3ZI=' 
WHERE 
  key_id = 'd27da9c9746ac6f08d328f6e68f05fbf0098975b2da7a60ec725d64f6bf9d391' 
  AND (
    token = 'pNW/PZbTgToBoULWv/r9CsK1eLQ2bkrVoL+JIXXr3ZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059