UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3btFNYJAKq2rHp6Ytgu+RIIou7ddISGLiynKE5r4L38=' 
WHERE 
  key_id = '7da145f54cec614c821740004db9899b47fe719fe465f9647741da8d048a3abd' 
  AND (
    token = '3btFNYJAKq2rHp6Ytgu+RIIou7ddISGLiynKE5r4L38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038