UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rE74mYtZy77h843PqgzjXi7ORrNHgNOH0p3Cb46GPc0='
WHERE
key_id = '49b80869808d2d529a478a0595996320c3a6b0d4314d92042a73c1ca8415dda9'
AND (
token = 'rE74mYtZy77h843PqgzjXi7ORrNHgNOH0p3Cb46GPc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)