UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fqMGrwxZIWEvKIy9ZMd1349irfV8pxPiMHxhEeqijso=' 
WHERE 
  key_id = '584adacacae01f36085a8d25c75e72e9b442f54699003218b494512f350c9e94' 
  AND (
    token = 'fqMGrwxZIWEvKIy9ZMd1349irfV8pxPiMHxhEeqijso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051