UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9PN1bcEKc5PWJDxesY5lJJZMfK+CyEvSiXW8LEzcsRo='
WHERE
key_id = 'cda10df569da46a963065b63436b2c7c59643ae632062d4a1f9f0c38082624e3'
AND (
token = '9PN1bcEKc5PWJDxesY5lJJZMfK+CyEvSiXW8LEzcsRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)