UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q6tPjYFUe0+DE9ILzWpOVZQ8r5WDuqoyPXbeTJyTx8I='
WHERE
key_id = 'c78e3c05c1005b19ac51cfbb513f4085cfd1d64321ab1b691a578860b5ac2680'
AND (
token = 'Q6tPjYFUe0+DE9ILzWpOVZQ8r5WDuqoyPXbeTJyTx8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)