UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M+toLkhyN0+4aB69SVQMHysMy/9p5t79XLjQ88uCowk=' 
WHERE 
  key_id = '13deb2cb240c7df64b273e6399b95dba8b3b8734eb784afc8483393c10d2c86c' 
  AND (
    token = 'M+toLkhyN0+4aB69SVQMHysMy/9p5t79XLjQ88uCowk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029