UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RVwcjWUYaFIIFEW2Dz/Vl1scwT5AKgTtmXb+Egy0jz8='
WHERE
key_id = '01dab66ed301259a8a9191a2e0164df9839968d61ef77bfa9de4b9f8edc2bc11'
AND (
token = 'RVwcjWUYaFIIFEW2Dz/Vl1scwT5AKgTtmXb+Egy0jz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)