UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bQ5THzI25fCXMxiPUjIdBiRI0ciTV+3K5yHUBumQ43k='
WHERE
key_id = '6c8d42dee152987e621ec0020d072b92d625b63daeb35e063a6c2f9886d3b00e'
AND (
token = 'bQ5THzI25fCXMxiPUjIdBiRI0ciTV+3K5yHUBumQ43k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)