UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uf5gPdfs7t7oLWhxUgSdNRop1dEoBevZvkpb37BNjAo='
WHERE
key_id = '1df530254f2a29d49366c495f48525ed22b33ff43c88e23d10bed04b54c57107'
AND (
token = 'uf5gPdfs7t7oLWhxUgSdNRop1dEoBevZvkpb37BNjAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)