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