UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+xutyqkAJedW7l0GibdzlnytRG3SNhjk/poFeyBF3+4=' 
WHERE 
  key_id = 'cc9111c1b0f98b4fdaadbe8e2a93b41cc30d2337fd4d5c4be76a9b2a4d6008d4' 
  AND (
    token = '+xutyqkAJedW7l0GibdzlnytRG3SNhjk/poFeyBF3+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028