UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'snZrjIT0Al0SUu3dXCqLjLfGSfcmbC579vgJZlXTz1k=' 
WHERE 
  key_id = 'c785f835536303687247084298fea6252f7d1592e885d72a195bdd95094abe79' 
  AND (
    token = 'snZrjIT0Al0SUu3dXCqLjLfGSfcmbC579vgJZlXTz1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00211