UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p406xNZcOKLNi/WRM/4LKYq94bf2tf7/9hb0q6yrEvI='
WHERE
key_id = 'd415ada9401ed777d70fcf988db2b6633fa22224320a8e669c0869b361133274'
AND (
token = 'p406xNZcOKLNi/WRM/4LKYq94bf2tf7/9hb0q6yrEvI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)