UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'raekLGvRrJL0xKBpnGMO51EJxtkJHGT9dFcmV3+5vm0='
WHERE
key_id = '2396d62fb4b9710134b637501f7177fdf9411c8b05cfd27c2d355b338fc7ea10'
AND (
token = 'raekLGvRrJL0xKBpnGMO51EJxtkJHGT9dFcmV3+5vm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)