UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vfAJKvsml1or3z4SqTRaQLT3MkiE5LsOhwmN2kEDjpY='
WHERE
key_id = 'a46a8d9b8cbd88df29d608df19e66f8c86b2a6aafd3bb2898e5307974d7fc7a3'
AND (
token = 'vfAJKvsml1or3z4SqTRaQLT3MkiE5LsOhwmN2kEDjpY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)