UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kEdUYNSA3ks0jM6Ogbw83+SflupojpMGZ7WmdSwdBn4='
WHERE
key_id = '08e9faf9e62db8f4bf67867e33e8e59c06a1c994101e05772cead7740e1de8fb'
AND (
token = 'kEdUYNSA3ks0jM6Ogbw83+SflupojpMGZ7WmdSwdBn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)