UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O3gRM7mdTnSJneD02GjyP080T8qu4MArXwBAZK4ClDs='
WHERE
key_id = '8b6eb6bc8550cf9930aae0800b50f595ecca3fa1a97deb3ac968bb999252f7ce'
AND (
token = 'O3gRM7mdTnSJneD02GjyP080T8qu4MArXwBAZK4ClDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)