UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lg7m3swOEj6x9JmdkPZRsZHujTcT9t+mXcud8PTJzO0='
WHERE
key_id = 'd3497ba67258765510528503b8300cf7d6ef5a7ef0efdb327a8329dc455cb1af'
AND (
token = 'lg7m3swOEj6x9JmdkPZRsZHujTcT9t+mXcud8PTJzO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)