UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dqncno3U7YaL+3RBquFyxo4Ouvqo8ujqvWZmArE1pqQ=' 
WHERE 
  key_id = 'cfa871b67379bda381c28e4de27c98846b9947d90691988286497f1b861ed6a2' 
  AND (
    token = 'Dqncno3U7YaL+3RBquFyxo4Ouvqo8ujqvWZmArE1pqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052