UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pqc7bwDfeJAsDRrMTo0N9Z8586n/25cRcSEiG+IuV4s='
WHERE
key_id = 'd0cd3153b9a08143fdd81652ae9ad21ea65858bca23c7af8992b0e2f50cfe7bd'
AND (
token = 'pqc7bwDfeJAsDRrMTo0N9Z8586n/25cRcSEiG+IuV4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)