UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HbyNEr+1wr912pIPGWP0yJu+CdGtqptWmgVSs6tHERs='
WHERE
key_id = 'bccb17b29ec6e68e1034d355270f81938fbb7fbd152c1a734363a6df77049c2c'
AND (
token = 'HbyNEr+1wr912pIPGWP0yJu+CdGtqptWmgVSs6tHERs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)