UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6To0ioQ6xG1MtwOov1mHQGJOGj9hJJqLTnlaQO2XILk='
WHERE
key_id = 'd6595628d88772c57f791fd03141f5d96eb8585078859e4e02c98a1f6d0d21b6'
AND (
token = '6To0ioQ6xG1MtwOov1mHQGJOGj9hJJqLTnlaQO2XILk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)