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