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