UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9bLbHnYX+vA4wT3p3ASXORlhGxOs47GhD+CoYksj5gA=' 
WHERE 
  key_id = '8430fd4073504f2ccbef20e9c88888a42373b2ec6b51dba6d5914cbb6b479391' 
  AND (
    token = '9bLbHnYX+vA4wT3p3ASXORlhGxOs47GhD+CoYksj5gA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033