UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fgdxN6lSHxxi752ox6Yohkk1AVE8ZuMdWfiEIOmUlY8='
WHERE
key_id = '64fe9e22c634b5fe7557fe3869534a6e61c7e2bf4db2f9d4a8fb8fe04ac6353a'
AND (
token = 'fgdxN6lSHxxi752ox6Yohkk1AVE8ZuMdWfiEIOmUlY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)