UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oNFD7f6IynzYKDDjatE3FTuuDiakGPtdjmZezkyD8rw='
WHERE
key_id = '7b1ca187471eb301946f0e4a3855c0236dfea1e78522df03469a0a91e0c0cd65'
AND (
token = 'oNFD7f6IynzYKDDjatE3FTuuDiakGPtdjmZezkyD8rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)