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