UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X1jrIM97O0+59wIAdjHan/k/isytZGwqJ4cp6CK1hn4=' 
WHERE 
  key_id = 'f810d488700f877c689023370c9aab4465b3fce688e8d09c2ca283b0e9535b17' 
  AND (
    token = 'X1jrIM97O0+59wIAdjHan/k/isytZGwqJ4cp6CK1hn4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034