UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SpjFGMwXfDDOuvDPKgs/GB16dLG37s0fRdz1X4xBd4w='
WHERE
key_id = 'f89b4405a949ac908bb7b640dbc0520fca014664ad275f4612f60a6e4375e1fc'
AND (
token = 'SpjFGMwXfDDOuvDPKgs/GB16dLG37s0fRdz1X4xBd4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)