UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3S6ncdHDn2K0kdYM7tb91n2cZhZr1fJpHpdTZxIW7Yk='
WHERE
key_id = 'f4a35868e2ebf657e044b14b6554c19877a3def17014c44e3d311b38f9fd1e58'
AND (
token = '3S6ncdHDn2K0kdYM7tb91n2cZhZr1fJpHpdTZxIW7Yk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)