UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd1sAw16s4vrCkXj1kG/6E3WcoorzWpcCku0A27gfVSs='
WHERE
key_id = '793971ac80a9f164af9dd21dc8827eb499cb89931f97edd575fbdf51c0f050b3'
AND (
token = 'd1sAw16s4vrCkXj1kG/6E3WcoorzWpcCku0A27gfVSs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)