UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7q2AKv+Hv2ti34xruDUjWz8R4XikOO0qPxm2/unMX9A='
WHERE
key_id = 'd5d3380bf20e4e7cff52a4451a904231a97983684695e129eeaee73885cab735'
AND (
token = '7q2AKv+Hv2ti34xruDUjWz8R4XikOO0qPxm2/unMX9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)