UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWtNEzI88yjQPM+podaYKJLGknD5bcOdM6/9hGyvTAs=' 
WHERE 
  key_id = '6104af22ad60ca657aec429c353417e0f80632709f9b3e266133696f7b0de038' 
  AND (
    token = 'qWtNEzI88yjQPM+podaYKJLGknD5bcOdM6/9hGyvTAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038