UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pcStW3Y6RAv9K6t93Kvpj8WFErCAZApqoHyQBSGAEB0=' 
WHERE 
  key_id = 'fa08d5074debf74c1ed4b14ffe732a0b667b45def9ec2b944813192d6dd91de9' 
  AND (
    token = 'pcStW3Y6RAv9K6t93Kvpj8WFErCAZApqoHyQBSGAEB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032