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