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