UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tgK1naKqZNs2H1PaYgE2hJrCZl12Rt9HIYL48ZtUo3M=' 
WHERE 
  key_id = '4c7a308adc249e05acfd308caf7ab3c7fa210d7f48171248f6acd59ba978a795' 
  AND (
    token = 'tgK1naKqZNs2H1PaYgE2hJrCZl12Rt9HIYL48ZtUo3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048