UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'peMoNrcNGr7w3Pgo2APnHr0h0aoam8fTSPYNd1Zs6x0=' 
WHERE 
  key_id = '501d51da329328a5e33573536b324b9cf9b2075ac95a249e12dacd988361d25d' 
  AND (
    token = 'peMoNrcNGr7w3Pgo2APnHr0h0aoam8fTSPYNd1Zs6x0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031