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