UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd0Jpd6m++KImlKBHh2DzmvFOyHzMPvpujgCn6uYQrMw='
WHERE
key_id = 'be657b4d3508706431f40813f74c61ad6788254a773a7b3b4726d2957507eada'
AND (
token = 'd0Jpd6m++KImlKBHh2DzmvFOyHzMPvpujgCn6uYQrMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)