UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7X0BSxJ84lodBPDseOGei68+fZu34DjLnreqLtkIqjw=' 
WHERE 
  key_id = '3f7d8a1cc8b228bf993b1bb05f556371b28220370157f8270e8883e1135359df' 
  AND (
    token = '7X0BSxJ84lodBPDseOGei68+fZu34DjLnreqLtkIqjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029